package net.steam.easyjoboa.entity;

public class PageBean {

	//当前页
	private int currentPage = 1;
	//每页显示数据
	private int pageSize = 10;
	//总记录
	private int totalRecords = 0;
	
	
	
	
	public int getFirstResult() {
		return (currentPage - 1) * pageSize;
	}

	/**
	 *�ж��Ƿ�����һҳ
	 * 
	 * @return
	 */
	public boolean getNext() {
		if (totalRecords % pageSize == 0) {
			return totalRecords / pageSize > currentPage ? true : false;
		} else {
			return (totalRecords / pageSize + 1) > currentPage ? true : false;
		}
	}

	/**
	 * �ж��ǲ��ǵ�һҳ
	 * 
	 * @return
	 */
	public boolean getPrew() {
		return currentPage > 1 ? true : false;
	}
	
	public int getLast() {
		if (totalRecords % pageSize == 0) {
			return totalRecords / pageSize;
		} else {
			return (totalRecords / pageSize + 1);
		}
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalRecords() {
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}
}
